#include "includes.h"


#ifdef USE_DEE
void DeeWr(uint16_t addr, uint8_t *dat, uint8_t len)
{
	uint8_t xdata *ptr;
	uint8_t i;
	uint8_t tmp;
	
	ptr = (uint8_t*)addr;
	for(i=0;i<len;i++)
	{
		ptr[i] = dat[i];
	}
	tmp = IE0;
	EA = 0;
	TA = 0xAA;												//Open TA
	TA = 0x55;
	EECON |= 0x01;										//Set EECON flag
	IE0 = tmp;
	while(EECON&0x01);								//Wait dee write finished
}

void DeeRd(uint16_t addr, uint8_t *dat, uint8_t len)
{
	uint8_t xdata *ptr;
	uint8_t i;
	
	ptr = (uint8_t*)addr;
	for(i=0; i<len;i++)
	{
		dat[i] = ptr[i];
	}
}
#endif	//USE_DEE

